﻿Option Explicit On ' Make sure all items are explicitly declared
Option Strict On ' Be Very Strict about things here!
Namespace Cards
    ''' <summary>Custom</summary>
    ''' <author>Comentsys</author>
    ''' <version>1.0.0</version>
    ''' <created>22nd February 2009</created>
    ''' <modified>22nd February 2009</modified>
    ''' <remarks>Custom Zune Card</remarks>
    Public Class Custom

        ' Private Members

        Private _Canvas As Canvas
        Private _Name As String = ""
        Private _Filename As String = ""

        ' Public Methods

        ''' <summary>Open</summary>
        ''' <param name="Filename">XAML Filename</param>
        ''' <remarks>Open XAML File and assign Canvas</remarks>
        Public Sub Open(ByVal Filename As String)
            Using xamlStream As IO.FileStream = IO.File.OpenRead(Filename)
                _Filename = Filename
                _Name = IO.Path.GetFileNameWithoutExtension(Filename)
                _Canvas = DirectCast(Markup.XamlReader.Load(xamlStream), Canvas)
            End Using
        End Sub

        ' Public Properties

        ''' <summary>Canvas</summary>
        ''' <value>Canvas</value>
        ''' <returns>Canvas UIElement</returns>
        ''' <remarks>Gets Card Canvas</remarks>
        Public ReadOnly Property Canvas() As Canvas
            Get
                If _Canvas Is Nothing Then
                    Return New Cards.SmallCard
                Else
                    Return _Canvas
                End If
            End Get
        End Property

        ''' <summary>Name</summary>
        ''' <value>String</value>
        ''' <returns>Name</returns>
        ''' <remarks>Gets Card Name</remarks>
        Public ReadOnly Property Name() As String
            Get
                Return _Name
            End Get
        End Property

        ''' <summary>Filename</summary>
        ''' <value>String</value>
        ''' <returns>Filename</returns>
        ''' <remarks>Gets File Name</remarks>
        Public ReadOnly Property Filename() As String
            Get
                Return _Filename
            End Get
        End Property
    End Class
End Namespace
